home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_readme.lha / gnu / gcc-faq.txt < prev    next >
Text File  |  1995-08-21  |  70KB  |  1,810 lines

  1.                               Amiga GNU CC FAQ
  2.                 Version 0.2
  3.  
  4.     This FAQ is intended to answer most (all, if possible) common questions
  5. concerning the Amiga Port of GCC.  It is divided into the following
  6. subsections:
  7.  
  8. 0.  General Introduction
  9.     a. The FSF, the GNU Project, and the GPL
  10.     b. What GCC has to offer
  11.     c. Hardware and Software requirements
  12. 1.  Obtaining and Installing the Beast
  13.     a. Sources of GCC
  14.     b. The breakdown of the distribution
  15.     c. Installation
  16.     d. Common Problems with the Installation
  17. 2.  Initial problems using GCC
  18.     a. Set your stack properly
  19.     b. Amiga specific library options
  20.        i) ixemul.library
  21.        ii) libnix
  22.        iii) libamiga.a and others
  23.     c. The object file format of GCC
  24.     i) Converting libraries to this format
  25.     d. Getting the Commodore includes
  26.     e. The frontend of the compiler 
  27.     f. Optimization may work where no optimization doesn't
  28.     g. Using the OS functions (an example)
  29. 3.  Amiga-specific extensions
  30.     a. The CHIP keyword  (not currently implemented)      
  31.     b. Command Line options
  32.        i) -noixemul   (maybe goes in 2. (b))
  33.        ii) -fbaserel
  34.        iii) -resident
  35.        iv)  Any more?
  36.     c. Startup Code options
  37. 4.  Advanced Questions
  38.     a. How do I build a cross-compiler?
  39.     b. Working with AmiTCP
  40.     c. Writing code for ixemul.library
  41.     d. Writing code for libnix
  42.     f. Saving some RAM
  43.     g. Writing shared libraries and resident (pure) code
  44.     h. I want to change over from SAS/C to GCC
  45.     i. Inline Headers
  46.     j. Writing Hooks
  47. 5.  C++ and Objective C
  48.     (don't know much about these, except that they're not as well
  49.      developed yet as the C compiler)
  50. 6.  Notes for Un*x Hackers
  51.     a. fork() is not implemented
  52. 7.  Support Utilities
  53.     a. Frontends
  54.     b. Debuggers  
  55.     c. What else?
  56. 8.  Additional Support 
  57.     a. amiga-gcc-port mailing list
  58.     b. snail mail (?)  - for people getting it off of CD-ROM
  59.     c. You never know, it could be a problem in base FSF code
  60.     (is there a newsgroup to point to here?)
  61. 9.  Known Bugs
  62.     a. the C compiler
  63.         i) -resident option
  64.         ii) -fbaserel option
  65.     b. the C++ compiler
  66.     c. the Objective C compiler
  67. 10. Maintainers and Contributors
  68. 11. Future
  69. 12. History
  70. Appendix A: How does the GPL affect programs compiled by GCC?
  71. Appendix B: GNU ports and who's dealing with them
  72. Appendix C: Another free C compiler (for those with little memory)
  73.  
  74. Section 0, General Introduction
  75. -------------------------------
  76.  
  77. a.  The FSF, the GNU Project, and the GPL
  78.     The Free Software Foundation (FSF) is an institution dedicated to
  79. the free flow of software (and information in general (?)).  To this end
  80. it has start the GNU (GNU's Not Unix) project, a collection of widely
  81. portable software of all sorts (compilers and Un*x utilities for the 
  82. most part, but some other stuff as well).  But I'm sure Richard Stallman,
  83. director and founder of the FSF, can say it better than I:
  84. [Note that this is heavily clipped;  You should get the original at
  85. prep.mit.edu]
  86.  
  87. ----------------------------------------------------------------------
  88. Copyright (C) 1985, 1993 Free Software Foundation, Inc.
  89.  
  90.  
  91.  
  92. The GNU Manifesto
  93. *****************
  94.  
  95.  
  96. Why I Must Write GNU
  97. ====================
  98.  
  99.    I consider that the golden rule requires that if I like a program I
  100. must share it with other people who like it.  Software sellers want to
  101. divide the users and conquer them, making each user agree not to share
  102. with others.  I refuse to break solidarity with other users in this
  103. way.  I cannot in good conscience sign a nondisclosure agreement or a
  104. software license agreement.  For years I worked within the Artificial
  105. Intelligence Lab to resist such tendencies and other inhospitalities,
  106. but eventually they had gone too far: I could not remain in an
  107. institution where such things are done for me against my will.
  108.  
  109.    So that I can continue to use computers without dishonor, I have
  110. decided to put together a sufficient body of free software so that I
  111. will be able to get along without any software that is not free.  I
  112. have resigned from the AI lab to deny MIT any legal excuse to prevent
  113. me from giving GNU away.
  114.  
  115. Why GNU Will Be Compatible with Unix
  116. ====================================
  117.  
  118.    Unix is not my ideal system, but it is not too bad.  The essential
  119. features of Unix seem to be good ones, and I think I can fill in what
  120. Unix lacks without spoiling them.  And a system compatible with Unix
  121. would be convenient for many other people to adopt.
  122.  
  123. How GNU Will Be Available
  124. =========================
  125.  
  126.    GNU is not in the public domain.  Everyone will be permitted to
  127. modify and redistribute GNU, but no distributor will be allowed to
  128. restrict its further redistribution.  That is to say, proprietary
  129. modifications will not be allowed.  I want to make sure that all
  130. versions of GNU remain free.
  131.  
  132. Why Many Other Programmers Want to Help
  133. =======================================
  134.  
  135.    I have found many other programmers who are excited about GNU and
  136. want to help.
  137.  
  138.    Many programmers are unhappy about the commercialization of system
  139. software.  It may enable them to make more money, but it requires them
  140. to feel in conflict with other programmers in general rather than feel
  141. as comrades.  The fundamental act of friendship among programmers is the
  142. sharing of programs; marketing arrangements now typically used
  143. essentially forbid programmers to treat others as friends.  The
  144. purchaser of software must choose between friendship and obeying the
  145. law.  Naturally, many decide that friendship is more important.  But
  146. those who believe in law often do not feel at ease with either choice.
  147. They become cynical and think that programming is just a way of making
  148. money.
  149.  
  150.    By working on and using GNU rather than proprietary programs, we can
  151. be hospitable to everyone and obey the law.  In addition, GNU serves as
  152. an example to inspire and a banner to rally others to join us in
  153. sharing.  This can give us a feeling of harmony which is impossible if
  154. we use software that is not free.  For about half the programmers I
  155. talk to, this is an important happiness that money cannot replace.
  156.  
  157. How You Can Contribute
  158. ======================
  159.  
  160.    I am asking computer manufacturers for donations of machines and
  161. money.  I'm asking individuals for donations of programs and work.
  162.  
  163.    One consequence you can expect if you donate machines is that GNU
  164. will run on them at an early date.  The machines should be complete,
  165. ready to use systems, approved for use in a residential area, and not
  166. in need of sophisticated cooling or power.
  167.  
  168.    I have found very many programmers eager to contribute part-time
  169. work for GNU.  For most projects, such part-time distributed work would
  170. be very hard to coordinate; the independently-written parts would not
  171. work together.  But for the particular task of replacing Unix, this
  172. problem is absent.  A complete Unix system contains hundreds of utility
  173. programs, each of which is documented separately.  Most interface
  174. specifications are fixed by Unix compatibility.  If each contributor
  175. can write a compatible replacement for a single Unix utility, and make
  176. it work properly in place of the original on a Unix system, then these
  177. utilities will work right when put together.  Even allowing for Murphy
  178. to create a few unexpected problems, assembling these components will
  179. be a feasible task.  (The kernel will require closer communication and
  180. will be worked on by a small, tight group.)
  181.  
  182.    If I get donations of money, I may be able to hire a few people full
  183. or part time.  The salary won't be high by programmers' standards, but
  184. I'm looking for people for whom building community spirit is as
  185. important as making money.  I view this as a way of enabling dedicated
  186. people to devote their full energies to working on GNU by sparing them
  187. the need to make a living in another way.
  188.  
  189. Why All Computer Users Will Benefit
  190. ===================================
  191.  
  192.    Once GNU is written, everyone will be able to obtain good system
  193. software free, just like air.(2)
  194.  
  195.    This means much more than just saving everyone the price of a Unix
  196. license.  It means that much wasteful duplication of system programming
  197. effort will be avoided.  This effort can go instead into advancing the
  198. state of the art.
  199.  
  200.    Complete system sources will be available to everyone.  As a result,
  201. a user who needs changes in the system will always be free to make them
  202. himself, or hire any available programmer or company to make them for
  203. him.  Users will no longer be at the mercy of one programmer or company
  204. which owns the sources and is in sole position to make changes.
  205.  
  206.    Schools will be able to provide a much more educational environment
  207. by encouraging all students to study and improve the system code.
  208. Harvard's computer lab used to have the policy that no program could be
  209. installed on the system if its sources were not on public display, and
  210. upheld it by actually refusing to install certain programs.  I was very
  211. much inspired by this.
  212.  
  213.    Finally, the overhead of considering who owns the system software
  214. and what one is or is not entitled to do with it will be lifted.
  215.  
  216.    Arrangements to make people pay for using a program, including
  217. licensing of copies, always incur a tremendous cost to society through
  218. the cumbersome mechanisms necessary to figure out how much (that is,
  219. which programs) a person must pay for.  And only a police state can
  220. force everyone to obey them.  Consider a space station where air must
  221. be manufactured at great cost: charging each breather per liter of air
  222. may be fair, but wearing the metered gas mask all day and all night is
  223. intolerable even if everyone can afford to pay the air bill.  And the
  224. TV cameras everywhere to see if you ever take the mask off are
  225. outrageous.  It's better to support the air plant with a head tax and
  226. chuck the masks.
  227.  
  228.    Copying all or parts of a program is as natural to a programmer as
  229. breathing, and as productive.  It ought to be as free.
  230.  
  231. ---------------------------------------------------------------------
  232.  
  233.  
  234. The GNU Public License (GPL) was written in order to keep software published
  235. under it free.  Here's the Preamble of the GPL:
  236.  
  237. ---------------------------------------------------------------------
  238.             GNU GENERAL PUBLIC LICENSE
  239.                Version 2, June 1991
  240.  
  241.  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  242.                           675 Mass Ave, Cambridge, MA 02139, USA
  243.  Everyone is permitted to copy and distribute verbatim copies
  244.  of this license document, but changing it is not allowed.
  245.  
  246.                 Preamble
  247.  
  248.   The licenses for most software are designed to take away your
  249. freedom to share and change it.  By contrast, the GNU General Public
  250. License is intended to guarantee your freedom to share and change free
  251. software--to make sure the software is free for all its users.  This
  252. General Public License applies to most of the Free Software
  253. Foundation's software and to any other program whose authors commit to
  254. using it.  (Some other Free Software Foundation software is covered by
  255. the GNU Library General Public License instead.)  You can apply it to
  256. your programs, too.
  257.  
  258.   When we speak of free software, we are referring to freedom, not
  259. price.  Our General Public Licenses are designed to make sure that you
  260. have the freedom to distribute copies of free software (and charge for
  261. this service if you wish), that you receive source code or can get it
  262. if you want it, that you can change the software or use pieces of it
  263. in new free programs; and that you know you can do these things.
  264.  
  265.   To protect your rights, we need to make restrictions that forbid
  266. anyone to deny you these rights or to ask you to surrender the rights.
  267. These restrictions translate to certain responsibilities for you if you
  268. distribute copies of the software, or if you modify it.
  269.  
  270.   For example, if you distribute copies of such a program, whether
  271. gratis or for a fee, you must give the recipients all the rights that
  272. you have.  You must make sure that they, too, receive or can get the
  273. source code.  And you must show them these terms so they know their
  274. rights.
  275.  
  276.   We protect your rights with two steps: (1) copyright the software, and
  277. (2) offer you this license which gives you legal permission to copy,
  278. distribute and/or modify the software.
  279.  
  280.   Also, for each author's protection and ours, we want to make certain
  281. that everyone understands that there is no warranty for this free
  282. software.  If the software is modified by someone else and passed on, we
  283. want its recipients to know that what they have is not the original, so
  284. that any problems introduced by others will not reflect on the original
  285. authors' reputations.
  286.  
  287.   Finally, any free program is threatened constantly by software
  288. patents.  We wish to avoid the danger that redistributors of a free
  289. program will individually obtain patent licenses, in effect making the
  290. program proprietary.  To prevent this, we have made it clear that any
  291. patent must be licensed for everyone's free use or not licensed at all.
  292.  
  293.   The precise terms and conditions for copying, distribution and
  294. modification follow.
  295.  
  296. ------------------------------------------------------------------------
  297.  
  298. More information regarding the FSF, GNU, and the GPL can be obtained at
  299. gnu.prep.mit.edu.  Note that the source code of any GPLed software must be
  300. made available by the distributor (is this wording accurate?).  The GPL
  301. may also affect how you distribute your programs, or maybe not.
  302. For more information, check out Appendix A of this FAQ.
  303. (Do this before believing all the bad hype about it.  Then decide for
  304. yourself).
  305.  
  306. b.  What GCC has to offer.
  307.     A FREE C compiler, for starters.  I'm sure there's some other stuff.
  308.     It's available for a wide range of machines (and thus it can't be
  309.     beat for cross-compiling, at least on the Amiga).
  310.     For the interested, a chance to change it as you like, make your own
  311.       bug fixes, be an active part in the development process.
  312.  
  313. c. Hardware and Software Requirements
  314.    This depends upon what you're doing.  Here's an excerpt from Phillipe
  315. Brand's readme for his distribution on the net:
  316.  
  317.  
  318. - Systems:
  319. Any Amiga (ranging from A1000 up to A4000/40, including CD-32 & SX-1) will
  320. run amigados-gnu utilities.
  321.  
  322. - Memory:
  323. A minimum of 4MB free memory is needed in order to compile small/medium
  324. projects.
  325. More memory will be needed for large projects, such as recompiling gcc
  326. itself.
  327. Gigamem is known to work with GCC so *maybe* less memory will work. 
  328. But in this case, you'll need an MMU equiped amiga (A3000,A4000/40, etc...).
  329. VMM40 (Public Domain Virtual memory manager) is also known to work with GCC.
  330.  
  331. [Editor's note:  using the g++ compiler can require even more, like at 
  332.     least  6 MB of free RAM]
  333. - OS:
  334. Starting from this release [2.6.3], 1.3 systems are not longer supported.
  335. Gcc runs fine on all other systems, starting from 2.04 up to 3.1 (40.68).
  336.  
  337. - Disk Space;
  338. An installation of gcc requires the use of a hard disk. Approximately 10MB is
  339. required at present to install the compiler and utilities required to use it.
  340. In addition 3MB is required for the Commodore Developer Kit, which is required
  341. to be able to compile AmigaDOS specific programs. This kit is available direct
  342. from Commodore-Amiga.
  343.  
  344. [Note, this is not true for the FreshFish distribution, which can be run
  345. straight off the CD-ROM if desired.]
  346.  
  347. ----------------------------end quote---------------------------------
  348.  
  349. Yes, it can take a lot of resources, but that's a function of its
  350. portability.  Be glad you can count on having the same compiler on your
  351. Amiga at home or the Unix system at work (or vice versa :-)).  
  352.  
  353. 1.  Obtaining and Installing the Beast
  354. a. Sources of the Amiga port of GCC
  355.    There are a couple of options for getting GCC.
  356.    If you have access to the Internet, and ftp service, you can obtain
  357. the current version of GCC from Aminet, in dev/gcc.
  358. The main site of Aminet is ftp.wustl.edu in /pub/aminet, and has mirrors
  359. world-wide:
  360.                      USA (MO)                ftp.wustl.edu
  361.                      USA (WI)               ftp.netnet.net
  362.                      USA (TX)                 ftp.etsu.edu
  363.                      Scandinavia               ftp.luth.se
  364.                      Switzerland              ftp.eunet.ch
  365.                      Switzerland          ftp.math.ethz.ch
  366.                      Germany        kelly.uni-paderborn.de
  367.                      Germany          ftp.uni-paderborn.de
  368.                      Germany          ftp.uni-stuttgart.de
  369.                      Germany           ftp.uni-erlangen.de
  370.                      Germany           ftp.cs.tu-berlin.de
  371.                      Germany            ftp.tu-chemnitz.de
  372.                      Germany            ftp.fh-augsburg.de
  373.                      Germany             ftp.uni-bremen.de
  374.                      Germany                 ftp.uni-kl.de
  375.                      Germany              ftp.uni-trier.de
  376.                      Germany      ftp.informatik.rwth-aach
  377.                      France                    ftp.cnam.fr
  378.                      Portugal                 ftp.ci.ua.pt
  379.                      UK                   ftp.doc.ic.ac.uk
  380.                      UK                 micros.hensa.ac.uk
  381.  
  382.  
  383.     ftp.funet.fi also serves to act as a hub for porting GNU software to 
  384. the Amiga, and serves to mirror Phillipe Brand's Amiga GCC tree directly, so 
  385. that you may always find GCC there (particularly to guarantee the availability
  386. of source code).
  387.  
  388.    The distribution is broken up into several parts, both to make it
  389. easier to download and to respect the GPL.  Thus each archive is 
  390. broken into two parts, one for binaries and one for sources.
  391.  
  392.  
  393. Gcc-2.6.3 is split up into 15 archives:
  394.  
  395. gcc263-readme.lha    holds readmes files (include installation notes).
  396. gcc263-base.lha         basic gcc distribution, hold necessary files.
  397. gcc263-inclib.lha    headers and libraries.
  398. gcc263-c.lha        C compiler.
  399. gcc263-c-020.lha    68020+68881 version of C compiler.
  400. gcc263-c++.lha        C++ compiler, headers and libraries.
  401. gcc263-c++-020.lha    68020+68881 versions of C++ compiler.
  402. gcc263-objc.lha        Objective-C compiler, header and libraries.
  403. gcc263-objc-020.lha    68020+68881 versions of Objective-C compiler.
  404. gcc263-doc.lha        Gcc AmigaGuide(tm) documents & manpages.
  405. gcc263-utils.lha    Useful utilities needed for development.
  406. gcc263-utilsdoc.lha    Utilities documentation (guide & manpages).
  407. gcc263-texi.lha        All Texinfo documents.
  408. gcc263-diffs.lha    Diff files for all binaries.
  409. gcc263-src.lha        Source for gcc-2.6.3 plus diff file.
  410.  
  411.  
  412.    The second way is to utilize your CD-ROM drive and get one of Fred Fish's
  413. great CD-ROM collections. Any of the FreshFish or GoldFish Vol. 2 will
  414. have it, though the later the CD-ROM the later the version.  He also
  415. includes as many ports of GNU utilities as he can.  His restriction is
  416. simply that the binaries he includes must be compilable from the sources
  417. he includes (this has been a problem in the past, and Fred is a stringent
  418. observer of the GPL).  So, yes, you also get all the sources with the
  419. binaries.  (If you've got a CD-ROM drive, you should get one of these 
  420. anyway; it's a great deal).
  421.    These CD-ROMs may be purchased from Amiga Library Services by:
  422. Snail Mail:  Amiga Library Services
  423.          610 N. Alma School Road, Suite 18
  424.          Chandler, AZ   85224-3687
  425.          USA
  426. FAX or Voice: (602) 491-0048
  427. Phone:           (800) 804-0833
  428. or Email:    orders@amigalib.com
  429. (but sending credit card information over e-mail is not secure, so one
  430. of the other methods would be preferable.  Fred is working on using some
  431. kind of encryption though.  More details when they're available.)
  432.  
  433.    There may be other CD-ROMs containing GCC, I just know of Fred's since
  434. he is directly involved in the porting of it.
  435.    The breakdown of this distribution is different.  Check the specific
  436. CD-ROM for details.  They also include the Commodore Native Developer
  437. Updates (no Autodocs) for 2.04, 3.0, and 3.1, which is a big bonus.  
  438.    
  439. c.  Installation
  440.     Installation procedures may vary depending on your source, but
  441. the final directory structure should be the same.  Check the README
  442. files included in your distribution package for more details.  
  443.     
  444.     The ftp distribution (Phillipe Brand's) contains an Installer program.
  445.     It utilizes the following layout:
  446.  
  447. Name            What                    Where    
  448. ----            ----                    -----
  449.  
  450. COPYING            GNU LICENSE, read!!            All archives
  451. COPYING.LIB        GNU LIBRARY LICENSE, read!!        All archives
  452. README-2.6.3        this file                All archives
  453. NEWS-2.6.3        What's new in gcc-2.6.3            gcc263-base
  454. Installer        Commodore installer utility        gcc263-base
  455. GCC-Install        Installer script to configure gcc    All archives
  456. envarc/            global environment variables you should
  457.             have set when using this programming    gcc263-base
  458.             environment
  459. include/        non-amiga specific C/C++ headers    gcc263-inclib
  460. os-include/proto    amiga specific protos headers.        gcc263-inclib
  461. os-include/inline    amiga specific inline C headers. Add    gcc263-inclib
  462.             Commodore headers!!        
  463. os-lib/            amiga specific libraries        gcc263-base
  464. guide/            Docs in AmigaGuide(tm) format        gcc263-doc
  465. man/            this is the root for tons of man pages    gcc263-doc
  466. bin/            this is /bin, and contains all         gcc263-c
  467.             binaries of this distribution that    gcc263-c++
  468.             are meant to be directly invoked by    gcc263-utils
  469.             the user (contrary to the executables
  470.                  in lib/gcc-lib/, that are meant to be
  471.             invoked by a driver program like gcc)
  472. lib/            normal (not base relatives) libraries    gcc263-inclib
  473. lib/libm020/        normal 68020 libraries            gcc263-inclib
  474. lib/libb/        base relatives libraries        gcc263-inclib
  475. lib/libb/libm020/    base relatives using 68020 libraries    gcc263-inclib
  476. lib/libnix/        Non-ixemul libraries            gcc263-inclib
  477. lib/libm020/libnix/    Non-ixemul 68020 libraries        gcc263-inclib
  478. lib/libb/libnix/    Non-ixemul base relatives libraries    gcc263-inclib
  479. lib/libb/libm020/libnix    Non-ixemul base relatives 68020 libs    gcc263-inclib
  480. lib/gcc-lib/        home of compilers called by gcc        gcc263-c
  481.                                 gcc263-c++
  482.                                 gcc263-objc
  483. ixpipe/            a pipe handler needed by the library    gcc263-base
  484. libs/            ixemul.library                gcc263-base
  485. rexx/            ARexx wrappers for gcc and g++        gcc263-base
  486. src-patches/        source patches                gcc263-diffs
  487. geninline/        Perl scripts to generate inline headers    gcc263-inclib
  488.             and -lamy glue
  489.  
  490.  
  491.     A standard GNU directory tree structure has been adopted by the 
  492. porting team to make life easier for everyone.  Starting with the
  493. assign of GNU: to somewhere, we then have:
  494.  
  495.      GNU:amigados            
  496.      GNU:man
  497.      GNU:Info
  498.      GNU:etc
  499.      GNU:bin
  500.      GNU:include
  501.      GNU:lib
  502.      GNU:os-include
  503.      GNU:os-lib 
  504.  
  505.     Since one of the aims of porting GNU software is to be able to provide
  506. a Un*x like environment under AmigaOS, the porters decided to make a GNU
  507. "root directory" (GNU:) in which a standard Un*x directory tree can live, like
  508. /etc, /bin, and so on.  This decision makes for good Un*x compatibility.
  509.    Also, in the past, you would have to add many assigns (>=10) to have your
  510. GNU utilities working, and now it's just 5 (GNU:, MAN:, INFO:, ETC:, and 
  511. BIN: ).
  512. We no longer have a conflicting assign LIB: (which most other compilers use).
  513.  
  514. d. Common Installation Problems
  515.    Using the Installer program for the ftp distribution should get rid
  516. of these problems.
  517.    Check out the section on the specs file if you are having problems 
  518. customizing your installation (say you have another compiler, and don't
  519. want to have 2 separate copies of os-include).
  520.    Also, for those of you who refuse to read the README, you need the 
  521. Commodore includes.  Section 2 (d) tells you where to get them. 
  522.    See 2 (c) about the GCC object format.  You may need to convert some
  523. standard libraries.  Also check 2(a) on setting your stack properly.
  524.  
  525. 2.  Initial Problems with GCC
  526.  
  527. a.  Set your stack properly.
  528.     GCC needs a lot of stack to run.  For a nice, small (<1000 lines)
  529. source, a stack of 50,000 should do just fine.  For more complicated
  530. code, you may need more, but 250,000 should do in any case, for gcc alone.
  531.     Note that using make may increase the demands on the stack size, so
  532. the above suggestions may not hold.
  533.  
  534. A word from Phillipe Brand's README:
  535.  
  536. You need to have a 50.000 stack size in order to compile with GCC. This should
  537. be enough for most projects. Note than while recompiling gcc with itself it
  538. has taken more than 300KB stack. Stack can grow due to source complexity.
  539. Don't be afraid of it.
  540.  
  541. To set the stack size, see the AmigaDOS Command 'stack'. 
  542.  
  543. To use ar and/or ranlib, 50KB is the minimum acceptable. You should have a
  544. much larger stack, if you use larger libraries.
  545.  
  546. Starting with 2.6.3 a new environnement variable, GCCSTACK, enables gcc to
  547. read this variable and set stack upon startup. Thus now no need to set stack
  548. to huge values, only gcc/ld/cpp/cc1#? will automatically set new stack,
  549. according to GCCSTACK variable.
  550.  
  551. Simply commit a: 
  552.     setenv GCCSTACK value
  553. to set gcc stack to value.
  554.  
  555. Benefits: huge memory savings.
  556.  
  557. ----------------end quote
  558.  
  559. Note that GCC 2.7.0 will include automatic stack growth code, so you won't
  560. need to worry about this anymore.
  561.  
  562.  
  563. b. Amiga specific Library options
  564.     i) Ixemul.Library
  565.         This library was developed by Markus Wild when originally started
  566. porting GCC (up to version 2.3.3).  It is a shared library that emulates
  567. a lot of Un*x functions, making life a lot easier for folks porting
  568. GNU utilities and such.  Unfortunately, it is fairly resource hungry by
  569. Amiga standards, and has caused not a little irritation among Amiga
  570. users.  GCC opens ixemul.library by default, so if you want to avoid it, 
  571. you'll have to use -noixemul on the command line (see below in Amiga 
  572. specific extensions and/or coding with x.lib) and link to one of the 
  573. libraries below.
  574.     The general rule of thumb should be to use ixemul.library if you're
  575. writing something non-Amiga specific (e.g. porting something) or one of the
  576. below link libraries when writing something specifically for the Amiga.
  577.  
  578.     Using ixconfig to work:
  579. ----------------------------------
  580. [Joerg-Cyril Hoehle]
  581.  
  582. > Which ixconfig should we use for ixemul v40.4?
  583.  
  584. If you're using R.Luebbert ixem404lib.lha, use ixconfig from
  585. there. It's actually called bin in that archive :-(
  586. [generic]            2925    5396  54.2% -lh5- b464 Sep  3  1994 ixem/bin
  587.  
  588. The ixemul.library from the gcc263 archive is R.Luebbert's 40.4.
  589.  
  590. If you're using another one:
  591.  
  592. Fred Fish's: I don't know whether he removed the ArpBase field in the
  593. include/library/ixemul.h file. R.Luebbert removed it between his 40.2
  594. and 40.4, which was a big mistake IMHO (as this mail and others
  595. show). So I don't know which ixconfig is good for him.
  596.  
  597. Leonard's: He told me that he had never removed this field, so get any
  598. old ixconfig you'll find. The one from the gcc263 archive will do.
  599.  
  600.  
  601.  
  602.      ii) libnix
  603.          This is a standard link library to replace the functionality of
  604. ixemul.library. Make sure you link to it if you use the -noixemul command
  605. line option for gcc.  Here's the readme file from the distribution:
  606.  
  607. Short: A library for amiga specific development on gcc
  608. Type: dev/gcc
  609. Uploader: fleischr@izfm.uni-stuttgart.de
  610. Author: fleischr@izfm.uni-stuttgart.de, gnikl@informatik.uni-rostock.de
  611.  
  612. This is libnix, a static (i.e. link) library for gcc 2.3.3 or above.
  613. It's not a replacement for ixemul.library (though it's possible to
  614. recompile most of the gcc environment with libnix) but a good thing
  615. for amiga specific development on gcc:
  616.  
  617. * It's mostly compatible to SAS's way of handling things, i.e.
  618.   you get even an automatic shared library opening feature and
  619.   some other things you may miss in ixemul.library.
  620.   This also means it's ANSI compliant.
  621.  
  622. * It doesn't need any shared libraries than normal Amiga OS ones.
  623.  
  624. * It is not copyrighted by the FSF. Therefore you neither need
  625.   to include sources nor objects together with your executable.
  626.   (read the GLGPL _before_ flaming on this statement)
  627.  
  628. * And it's short! I was able to compile a 492 byte 'hello, world'
  629.   using normal main.
  630.  
  631. * It uses OS20 features whenever necessary.
  632.  
  633. To cut it short:
  634.  
  635. Use ixemul.library for porting Un*x programs, libnix for compiling
  636. amiga-only programs and gcc becomes one of the best Amiga compilers.
  637.  
  638. There is no need to download this archive if you use gcc2.6.0 or above
  639. since the libraries itself are included with the normal gcc distribution.
  640.  
  641. But if you use an older gcc version or if you want to get the sources
  642. you can take this package. But be warned: The ld that comes with earlier
  643. versions of gcc has some serious trouble with set elements. You cannot
  644. use libnix without the fixed linker that comes with gcc2.6.0.
  645.  
  646.  
  647.      iii) Gerlib
  648.           Obsolete
  649.  
  650.      iv) the PDC library   
  651.           Obsolete 
  652.  
  653. c.  The object file format of GCC
  654.      
  655.      Yes, GCC uses its own object file format.  This means you aren't 
  656. currently able to link to AmigaDOS hunk format object files (standard).  
  657. But hunk2gcc (by Markus Wild) will do the conversion for you as described 
  658. below.
  659.  
  660.    Why does GCC use its own object file format?  It's really just a design
  661. decision that allows other gnu utilities to deal with these objects (for 
  662. example, gdb) without having to convert them to deal with AmigaDOS hunks. 
  663.  
  664. >From Brand's README-2.6.3
  665.  
  666. Starting from this release an AmigaDOS compliant library is provided,
  667. thanks to libnix authors (Matthias Fleischer and Gunther Nikl).
  668.  
  669. Anyway if you want to rebuild one, there are two methods:
  670.  
  671. 1) Using hunk2gcc; the AmigaDOS object converter made by Markus Wild. To
  672. achieve this, simply grab a copy of latest amiga.lib (from Commodore
  673. Development Kit) and make a new directory where you want your converted
  674. object files to go, cd into it, and enter
  675.  
  676.   hunk2gcc amiga.lib [..further libs if you like..]
  677.  
  678. This generates an a.out object file for every program unit present in the
  679. hunk file (in this case, from amiga.lib).
  680.  
  681. As the final step convert all those files into an a.out style library by
  682. issuing:
  683.  
  684.   ar qc libamiga.a obj.*
  685.   ranlib libamiga.a
  686.  
  687. The ranlib run builds a symbol table in the archive, and makes accesses to
  688. the library much faster.
  689.  
  690. 2) Creating a libamiga.a library with libnix is fairly easy, but takes some
  691. time. Just uncompress sources.lha from libnix distribution and run a
  692. 'make libamiga.a'.
  693.  
  694. NOTE:
  695.  
  696. As long as you make no AmigaDOs specific calls, you can create a dummy library
  697. using:
  698.  
  699.   cat "int dummy;" >dummy.c
  700.   gcc -c dummy.c
  701.   ar crv libamiga.a dummy.o
  702.   mv libamiga.a gcc:lib
  703.  
  704. A small libamiga.a (dummy) is also provided with libnix.
  705.  
  706.  
  707.     d. Getting the Commodore includes
  708. [Jochen Wiedmann]
  709.  
  710. You can obtain the includes and some developer tools from any Fish CD
  711. and some other CD's as well.
  712.  
  713. However, you will be missing the autodocs, which are definitely the
  714. best information source for the OS functions. You can get them either
  715. by buying the
  716.  
  717.     The Amiga ROM Kernel Manual:  Includes and Autodocs, ISBN
  718.                                                           0-201-56773-3
  719.  
  720. (about 50-60$, as far as I know), or by buying the so-called NDU
  721. (Native developers update kit, 5 disks, about 40$) from
  722.  
  723.          Fa. Hirsch & Wolf
  724.          Mittelstr. 33
  725.          56564 Neuwied
  726.      Germany
  727.  
  728.          Phone: (0049) +2631 83990
  729.      Email: hhhirsch@carla.adsp.sub.org
  730.  
  731. Sorry, but this is still the *only* source for the NDU, at least as
  732. long as CATS (Commodore Amiga Technical Support) isn't alive.
  733.  
  734. I'd prefer buying the NDU, because it contains the newer information
  735. than the book and I prefer it online.
  736.  
  737.  
  738.  
  739.     e. The frontend of the compiler 
  740.          amigados-gcc and gcc are the same thing.
  741.          AREXX scripts:
  742.  
  743. The provided ARexx scripts have been contributed by Loren J. Rittle.
  744. If you like ARexx, they're an alternate way of calling gcc. They 
  745. automatically make sure you're using a large enough stack setting, and 
  746. enable you to compile C++ programs with less obscure options. This 
  747. approach is furthermore useful if you're not able to use the g++ /bin/sh
  748. script.
  749.  
  750.     f. Optimization may work where no optimization doesn't
  751.          The folks who write GCC almost always use -O when compiling
  752. GCC and other stuff.  Hence, the -O routines are better tested than
  753. those without optimization.  So you may want to try it.
  754.  
  755. g.) Using the OS functions with gcc.
  756.  
  757. [Jochen Wiedmann, with a small suggestion by Christian Stieber]
  758.  
  759. Let's write a simple "HelloWorld.c":
  760.  
  761.     /*  Compile me with
  762.         gcc -noixemul -o HelloWorld HelloWorld.c -lauto
  763.     */
  764.     #include <stdlib.c>
  765.     #include <intuition/intuition.h>
  766.     #include <proto/intuition.h>
  767.  
  768.     int main(int argc, char *argv[])
  769.  
  770.     {
  771.         struct EasyRequest er;
  772.  
  773.         er.es_StructSize = sizeof(er);
  774.         er.es_Flags = 0;
  775.         er.es_Title = "Message";
  776.         er.es_TextFormat = "Hello, world!\nintuition.library is at 0x8l.";
  777.         er.es_GadgetFormat = "Ok";
  778.         EasyRequest(NULL, &er, NULL, IntuitionBase);
  779.     exit(0);
  780.     }
  781.  
  782. Some notes:
  783.  
  784.   - We are using the function EasyRequestArgs() from intuition.library. 
  785.     Thus we have to include the appropriate headers: intuition/intuition.h
  786.     for the structures and constants, proto/intuition.h for the 
  787.     function prototypes. Do not use headers from other compilers (for
  788.     example pragmas/intuition.h), gcc headers (inline/intuition.h,
  789.     included by proto/intuition.h) or even OS headers
  790.     (clib/intuition_protos.h). The only exception are clib/alib_protos.h
  791.     and clib/alib_stdio_protos.h: These represent link libraries and not
  792.     shared libraries.
  793.  
  794.   - We did *not* open intuition.library. gcc does this for you by
  795.     including proto/intuition.h and linking against libauto.a.
  796.     However, this works only for OS libraries. Consult the GNU:libauto
  797.     directory, if you want to know how to get the same possibilities for
  798.     other shared libraries.
  799.  
  800.     Using proto/intuition.h you are safe and even source compatible
  801.     to SAS/C and Dice.
  802.  
  803.   - If you *need* to open a library manually, do it as follows:
  804.  
  805.     #include <stdlib.h>
  806.     #include <stdio.h>
  807.         #include <intuition/intuition.h>
  808.     #include <proto/intuition.h>
  809.  
  810.         struct IntuitionBase *IntuitionBase = NULL;
  811.     /*  Explicit initialization with NULL is a *must*!  */
  812.  
  813.     void Cleanup(void)
  814.  
  815.     {
  816.         if (IntuitionBase) CloseLibrary(IntuitionBase);
  817.     }
  818.  
  819.     int main(int argc, char *argv[])
  820.  
  821.     {
  822.         if (atexit(Cleanup)) {
  823.         perror("atexit");
  824.         exit(20);
  825.         }
  826.  
  827.         if (!(IntuitionBase = (struct IntuitionBase *)
  828.             OpenLibrary("intuition.library", 37))) {
  829.         fprintf(stderr, "Cannot open intuition.library, V37");
  830.         exit(20);
  831.         }
  832.  
  833.         /* Same program as above */
  834.     }
  835.  
  836.      Note the use of atexit(), which makes exit() calling Cleanup().
  837.  
  838. Note this possible alteration:
  839.  
  840. >         struct EasyRequest er;
  841. >         er.es_StructSize = sizeof(er);
  842.  
  843. This seems to be correct, but I suggest hardcoding 5*sizeof(ULONG) here.
  844. That field serves as version information; using sizeof() and compiling
  845. with newer headers would tell the OS that you're using the new structure.
  846. But the additional fields will contain garbage...
  847.  
  848.  
  849. 3.  Amiga-specific extensions
  850.  
  851.     a. The CHIP keyword      
  852.  
  853.     Most C compilers for the Amiga have a CHIP keyword or equivalent to
  854. signify that an object should stored CHIP memory when declared.  I.e., 
  855. CHIP struct Image *my_graphics = { ... } 
  856. will cause the memory for the data to which my_graphics points to be allocated
  857. in CHIP memory (pretty handy, huh?)
  858.     This is obviously Amiga-specific, so of course it's not implemented
  859. in the FSF code. BUT, the linker (ld) currently recognizes -chip and -fast 
  860. options.  However, these haven't been put in gcc itself quite yet, though I 
  861. have been assured they will be here soon (there have been more important 
  862. things to work on, like getting -resident to work again, see below).
  863.          So if you're using 2.6.3 or below, here are some basic work-arounds:
  864.  
  865. (I gotta find these)
  866.  
  867.     b. Command Line options
  868.  
  869.        i) -noixemul   (maybe just reference 2. (b))
  870.               This option prevents gcc from making your executable open
  871. ixemul.library (of course, your program can still do so).  Make sure you
  872. link to libnix or something similar to access those functions.
  873.            See also 2. (b) (ii)
  874.  
  875.        ii) -fbaserel (currently broken until 2.7.0)
  876. [from Christian Stieber]
  877.             -fbaserel turns on base relative adressing; which means that 
  878. global/static variables are referenced with a 16 bit offset relative to an 
  879. address register (a4 is generally used for that). The startup-code loads a4 
  880. with a pointer into the data segment. Result: every access to a global/shared
  881. variable is only 16 bit instead of the usual 32 bit address -> shorter & 
  882. faster. It also means that you're limited to at most 64K of global/static 
  883. variables.
  884.  
  885.        iii) -resident
  886. [from Christian Stieber] 
  887.            A "resident" program (the correct term is "pure") is a program that
  888. can be loaded into memory just once, but executed by serveral processes
  889. at the same time. Therefore, "resident" is actually "code sharing".
  890. -resident turns on -fbaserel and links with a special startup code.
  891. That first thing that special startup code is to allocate some memory,
  892. copy the global/static variables into it and load a4 with a pointer to
  893. that memory. Then, a normal startup-code and your normal program
  894. is run. When the program exists, the memory block is freed.
  895. Result: Every process has its very own, private data segment for
  896. global/static variables. Since there all global/static variables are
  897. accessed via a4+16-bit-offset (because of -fbaserel), the original
  898. data segment is untouched. Result: the program can be executed
  899. independently by several processes, with every process getting its
  900. own data segment.
  901.  
  902.  
  903.     c. Startup Code options  (may be redundant)
  904.  
  905. 4.  Advanced Questions
  906.  
  907.     a. How do I build a cross-compiler?
  908. [from Phillipe Brand]
  909.  
  910. How to generate a cross-compiler, AmigaDOS side:
  911. ------------------------------------------------
  912.  
  913. - Get gcc-2.6.3.tar.gz from ftp.gnu.ai.mit.edu or mirror site
  914. - Get ftp.telesys-innov.fr:/pub/amigados-gnu/gcc-2.6.3-amiga.diffs file
  915.  
  916. >From CLI:
  917.  
  918. CLI> sh
  919. # zcat gcc-2.6.3.tar.gz | tar xvf -
  920. # cd gcc-2.6.3
  921. # zcat ../gcc-2.6.3-amiga.diffs | patch -p1
  922. # ./configure --host=amigados --target=CPU-COMPANY-SYSTEM
  923. # make
  924.  
  925. When compilers are built, all you have to do is installing it using
  926. make install, and to grab other architecture's libraries (libc.a, etc...),
  927. and headers.
  928.  
  929. More infos: See GCC AmigaGuide documentation, look for "Cross-Compiling".
  930.  
  931. How to generate a cross-compiler, Other architecture side:
  932. ----------------------------------------------------------
  933.  
  934. - Get gcc-2.6.3.tar.gz from ftp.gnu.ai.mit.edu or mirror site
  935. - Get ftp.telesys-innov.fr:/pub/amigados-gnu/gcc-2.6.3-amiga.diffs file
  936.  
  937. >From CLI:
  938.  
  939. CLI> sh
  940. # zcat gcc-2.6.3.tar.gz | tar xvf -
  941. # cd gcc-2.6.3
  942. # zcat ../gcc-2.6.3-amiga.diffs | patch -p1
  943. # ./configure --target=amigados (host should be determined by configure itself)
  944. # make
  945.  
  946. When compilers are built, all you have to do is installing it using
  947. make install, and to grab AmigaDOS GCC libraries (libc.a, etc...),
  948. and headers.
  949.  
  950. More infos: See GCC AmigaGuide documentation, look for "Cross-Compiling".
  951.  
  952. A working example of a cross-compiler running on sunos4.1.3 can be found
  953. in ftp.telesys-innov.fr:/pub/amigados-gnu/gcc-cross/....
  954.  
  955.  
  956.     b. Working with AmiTCP
  957.  
  958. > Could somebody please explain where exactly gcc and the libraries
  959. > that come with it fall down when it comes to using AmiTCP?
  960. > What's missing etc.
  961. > Then, Why can't (I assume you can't since veryone says you can't)
  962. > use the C= Developers kit with gcc without fiddling.
  963.  
  964. The problems are:
  965.  
  966. a) gcc uses it's own object module and library format, so lots of the GNU
  967. tools don't have to change too. 
  968.  
  969. b) gcc uses ixemul by default, which is not compatible directly with the SAS
  970. libraries supplied with AmiTCP. 
  971.  
  972. a) is just a design decision, and indeed there are tools to convert. (b) is
  973. harder to see; basically the SAS AmiTCP libraries assume the environment of
  974. SAS/C, complete with references to the SAS FILE structure internals and the
  975. functions which aren't in SAS or which need to be patched to work with
  976. AmiTCP. In addition, the netincludes supplied with the AmiTCP port include
  977. many items and structure definitions which are also defined in gcc, albeit
  978. differently, resulting in a very confised compiler if you mix them. 
  979.  
  980. Unfortunately, a simplistic port (recompile with the right -I directives)
  981. fails for two reasons; the includes are wrong, and even if they were matched,
  982. the SAS-directed library patches the wrong things. Resulting in an executable
  983. which will fail to operate as expected (it might work OK, or it might not -
  984. depends what you call & when). 
  985.  
  986. What is needed is a new library - take out the duplicate definitions, patch
  987. the right functions and remake the library for gcc. 
  988.  
  989. Does this help? 
  990.  
  991. Peter Ivimey-Cook.
  992.  
  993.  
  994.     c. Writing code for ixemul.library
  995.          After looking at Markus Wild's README, I couldn't see anything
  996. to include in particular, and the thing is way too long to put here.
  997. Any specific suggestions of stuff to clip out?
  998.  
  999.          Actually, considering the update activity, the current maintainers/
  1000. developers should be providing a new README.  Particularly the functions
  1001. available in the different versions (regular fxns, the ones in the network
  1002. version, and the conflicts.  Somebody recently answered a question about
  1003. this last part, saying he was trying to integrate the 2).      
  1004.  
  1005.             i)  Finding bugs with trace()
  1006.  
  1007. [Joerg-Cyril Hoehle]
  1008. more than one year ago, I corrected a huge bug in the program trace (a
  1009. buffer overflow). Together with ixemul.trace, this program allows you
  1010. to see every ixemul call (aka SnoopDOS for ixemul.library programs)
  1011. and may be useful for debugging.
  1012.  
  1013. Before, because of that overflow, trace hung the whole system very
  1014. often (and very soon) when tracing every ixemul call. Now, I've been
  1015. able to trace long sessions of gcc compilation to a (K)CON: window
  1016. without trouble.
  1017.  
  1018.  
  1019.  
  1020.     d. Writing code for libnix
  1021.         Maybe a referral to the libnix docs in the source file, or should
  1022. I stick them in here (I believe they're only in the source archive, so people
  1023. may tend not to grab it)?
  1024.  
  1025.      e.  Problems with asm() 
  1026.  
  1027. [Insert your answer here,please]
  1028.  
  1029.  
  1030.      f. How do I save RAM?
  1031. [Jochen Wiedmann]
  1032.  
  1033. A simple try is to do a
  1034.  
  1035.     setenv TMP MyHardDrive:t
  1036.  
  1037. before compiling. This will create temporary files on the harddisk and
  1038. not in RAM. Depending on what you compile this can save some 100K of
  1039. RAM while compiling and it doesn't slow down the compiler very much.
  1040.  
  1041. Another try is to turn off optimization. This prevents the "inline"
  1042. headers from being included, which need *very* much RAM. If you like
  1043. optimization (for example because of the additional checks!) you can
  1044. use the options
  1045.  
  1046.     -O -D__NOINLINES__
  1047.  
  1048. which turn on optimization, but prevent the inline headers from being
  1049. included. (The negative effect is, that you need an additional
  1050. function call any time, you use an OS function, but one can live with
  1051. it.)
  1052.  
  1053.     g. Writing shared libraries and resident (pure) code
  1054.  
  1055. Here is some discussion from the amiga-gcc-port mailing list 
  1056. [not cooked up yet]
  1057.  
  1058. [Peter Ivimey-Cook]
  1059.  
  1060. > Obviously there must be other solutions. Being able to build a library
  1061. > is not far away from being able to build a pure (=residentable)
  1062. > program, and gcc-2.3.3 was both largely above 64KB in size and
  1063. > residentable. So what's the trick?
  1064.  
  1065. Don't use global data referenced absolutely! residentable implies 
  1066. reentrant, which means that global data is read-only apart from the first 
  1067. instance (i.e. it's OK to initialise it, once, but once initialised it 
  1068. can't be modified or reinitialised). This effectively means the only data 
  1069. used in the must be on the stack or referenced from it by pointers, as 
  1070. the stack is separate for different invocations of a resident program.
  1071.  
  1072. Of course this does pose a major headache for programs which use lots of 
  1073. global data. And watch out for library use too!
  1074.  
  1075. Failing this, one must use a global data access mechanism which allows:
  1076.  
  1077. (a) the base address to be set up - e.g. by calling AllocMem() and 
  1078. storing the result in a register (NOT a global!)
  1079.  
  1080. (b) *all* accesses to "global" data are relative to this register.
  1081.  
  1082. [Peter Ivimey-Cook]
  1083. > BUT: If we build a shared lib from the static link lib, code exists only once
  1084. > and is SHARED between callers of the lib (callers means different executables, using the lib)
  1085. > Here the problem comes up that the DATA MUST not be shared between different callers.
  1086. > This is because it is PRIVATE to the individual caller.
  1087. > IMHO the only way to realize multiple callers is the use of -fbaserel, since now access
  1088. > is relative to the A4 register and thus, every program can have IT'S OWN data, without
  1089. > interferring with each other.
  1090.  
  1091. It depends on the way the library is constructed. Most Amiga libraries 
  1092. are written to be re-entrant - i.e. they don't use global data items 
  1093. which would require loading - they use the stack. For items which can't 
  1094. be done this way, there are two solutions -
  1095.  
  1096. 1. Use the library data space. It's global, unless you make provision for 
  1097. it to be otherwise - and availabl easily off a6.
  1098.  
  1099. 2. Manage your own data space, using tags or whatever to allocate space 
  1100. for callers. Note that the only indication you have as to who is the 
  1101. current caller is the result of FindTask(). 
  1102.  
  1103. So, in general libraries try to make required data passed through 
  1104. parameters, or available on the stack, or shareably global. In which case 
  1105. no baserel or anything else is required.
  1106.  
  1107.  
  1108. [Jochen Wiedmann]
  1109.   - Of course it is possible to write shared libraries (ixemul.library,
  1110.     for example) with gcc, but *only* if the source is written with a
  1111.     shared library in mind.
  1112.  
  1113.   - It is possible (Matthias told how) to develop a solution that would
  1114.     allow to use existing source of link libraries for shared libraries
  1115.     (libbfd sources, for example) with at most very minor modifications
  1116.  
  1117.   - -fbaserel would be a must for the above solution. On the other hand
  1118.     it is not possible yet, at least not without going to the assembler
  1119.     level. (Really deep, not just using some headers with asm keywords.)
  1120.  
  1121. [Christian Stieber]
  1122. > Jochen Wiedmann writes:
  1123. >  >   - Of course it is possible to write shared libraries (ixemul.library,
  1124. >  >     for example) with gcc, but *only* if the source is written with a
  1125. >  >     shared library in mind.
  1126. > Could you elaborate on that so that we know a little more about it,
  1127. > please?
  1128.  
  1129. - keep in mind that all callers use the same global and static variables;
  1130.   that means: either protect them with semaphores (e.g. if your library
  1131.   is using a memory pool), or allocate a block of memory inside your library
  1132.   and pass pointers around.
  1133.  
  1134. - the "startup" code will contain the ROMTag structure and related data,
  1135.   as well as stubs to push parameters on the stack, calling the C function,
  1136.   cleaning up the stack.
  1137.  
  1138. - I generally write the libOpen(), libClose(), libInit() etc. functions
  1139.   as normal C functions, but some people might prefer to put them into
  1140.   the "startup code".
  1141.  
  1142. That's about all. It also means that many link-lib functions (e.g. from
  1143. libnix) can't be used; this has to be decided on a per-function basis.
  1144. It's pretty safe to say that you can't use stdio and malloc(). strcpy(),
  1145. isdigit() are safe, etc. Just be careful. Think about what the function does;
  1146. that should give you an idea whether you can use it or not.
  1147.  
  1148. [Jochen Wiedmann]
  1149.  
  1150. > Jochen Wiedmann writes:
  1151. >  >   - Of course it is possible to write shared libraries (ixemul.library,
  1152. >  >     for example) with gcc, but *only* if the source is written with a
  1153. >  >     shared library in mind.
  1154. > Could you elaborate on that so that we know a little more about it,
  1155. > please?
  1156. > Does it mean that you can't use any global variable? Or only one but
  1157. > declare it with something like__asm__("a4") and use it as a base
  1158. > pointer? Does it imply that you must use the inline/*.h? Does it imply
  1159. > that you must use a special startup code (of course :-), what must it
  1160. > do?
  1161.  
  1162. In short: You may well use something like
  1163.  
  1164.   struct ExecBase *SysBase;
  1165.  
  1166. and read this variable from anywhere within your program, because you
  1167. can
  1168.  
  1169.   a) initialize it from the library startup code and
  1170.   b) be sure that it never changes
  1171.  
  1172. but you must not use global or static data otherwise.
  1173.  
  1174.  
  1175.  
  1176.  
  1177.     h.  I want to change from SAS/C to GCC
  1178.  
  1179.         Great!
  1180.  
  1181. [Kriton Kyrimis]
  1182.  
  1183. > I am also wondering if it is possible to link object files that were 
  1184. > created by different conpilers, specifically GCC and SAS. I need to do 
  1185.  
  1186. Try compiling SAS programs using DATA=FAR CODE=FAR, then use the hunk2gcc
  1187. program to convert the object files from amiga format to sun format.
  1188.  
  1189. One problem with this approach would be with floating point code and with
  1190. integer multiplication/division. If you can compile with CPU=68020 (or higher)
  1191. and MATH=68881, then SAS/C will produce inline code, and you will have no
  1192. problem. Otherwise, you'll have to grab the necessary modules from the SAS
  1193. libraries and convert them to sun format as well. (Compiling with the option
  1194. that produces code that uses utility.library, and linking with -lauto might
  1195. alleviate the problem.)
  1196. ----------------------------------
  1197.  
  1198.    And here's a little AREXX program to automagically convert sas libs to
  1199. gcc libs:
  1200.  
  1201. This arexx program is based on help from Philippe BRAND.
  1202.  
  1203.  
  1204. /********************************HISTORY**********************************
  1205. * 18-DEC-94 : DJR : Created                                              *
  1206. **************************************************************************
  1207. *                                                                        *
  1208. * Name      : saslib2libgcc                                              *
  1209. * Author    : David J. Ruscak  ruscakd@polaroid.com                      *
  1210. * Created   : 18-DEC-94                                                  *
  1211. * Purpose   : to convert SAS libraries to GCC libraries                  *
  1212. *                                                                        *
  1213. *************************************************************************/
  1214.  
  1215.  
  1216. /* To convert a SAS library to a GCC format library several steps are
  1217.    involved.
  1218.  
  1219.  1) cd to RAM: Either copy the library to RAM: or give the full path name.
  1220.  
  1221.     EX: gnu:saslib2libgcc X11:lib/Xtnb.lib
  1222.  
  1223.  2) You need the SAS Librarian 'oml' with a version =>  Library
  1224.     otherwise you'll get an error such as 'unknown hunk'.
  1225.  
  1226.  3) You need hunk2gcc, mv, ar and ranlib. If your using gcc you have the
  1227.     fastram, VMM2.1 swap works fine too.
  1228.  
  1229. */
  1230.  
  1231.  
  1232. /* TRACE R */
  1233. SIGNAL ON ERROR
  1234. OPTIONS RESULTS
  1235.  
  1236. IF ~SHOW('l','rexxsupport.library') THEN
  1237.   IF (~ADDLIB("rexxsupport.library",0,-30,0)) THEN
  1238.      DO
  1239.         ECHO "Can't load rexxsupport.library"
  1240.         EXIT 10
  1241.      END
  1242.  
  1243.  
  1244. fullname = ""
  1245.  
  1246. PARSE ARG fullname
  1247.  
  1248. IF fullname  == "" THEN
  1249.    DO
  1250.       ECHO " No Library to convert"
  1251.       ECHO ""
  1252.       ECHO " EX: gnu:saslib2libgcc X11:lib/Xtnb.lib"
  1253.       EXIT 10
  1254.    END
  1255.  
  1256. IF (~EXISTS(fullname)) THEN
  1257.    DO
  1258.       ECHO "Can't find" fullname
  1259.       EXIT 10
  1260.    END
  1261.  
  1262.  
  1263. ADDRESS COMMAND
  1264. /* make 2 directories for object files   */
  1265.  
  1266. IF EXISTS('object') THEN
  1267.    DO
  1268.      ECHO "Directory object exists Please delete or rename it."
  1269.      EXIT
  1270.    END
  1271. 'makedir  object'
  1272.  
  1273. IF EXISTS('object2') THEN
  1274.    DO
  1275.      ECHO "Directory object2 exists Please delete or rename it. "
  1276.      EXIT
  1277.    END
  1278. 'makedir  object2'
  1279.  
  1280. 'oml -oobject 'fullname 'X *' /* SAS Object Librarian  */
  1281.  
  1282.  
  1283. IF EXISTS('object') THEN
  1284.  DO
  1285.    objfiles = SHOWDIR('object','F')              /* list of all object files */
  1286.    nfiles = WORDS(SHOWDIR('object','F'))         /* count of object files    */
  1287.    DO    UNTIL nfiles == 0                /* must be a more efficient way... */
  1288.     'hunk2gcc >NIL: object/'WORD(objfiles,nfiles)   /* convert to GCC object */
  1289.     'mv >NIL: obj.#? object2/'WORD(objfiles,nfiles) /* restore original names*/
  1290.     nfiles = nfiles - 1
  1291.    END
  1292.  END
  1293.  
  1294.  
  1295. 'cd object2' /* directory of converted objects */
  1296. path =  PRAGMA('D','object2')
  1297.  
  1298. IF (INDEX(fullname,':') > 0) THEN    /* strip out assign */
  1299.         fullname = SUBSTR(fullname,LASTPOS(':',fullname) + 1)
  1300.  
  1301. IF (INDEX(fullname,'/') > 0) THEN    /* strip off directories */
  1302.         libname = SUBSTR(fullname,LASTPOS('/',fullname) + 1)
  1303. ELSE
  1304.         libname = fullname
  1305.  
  1306. dot = POS('.',libname)
  1307.  
  1308. gcclibname = 'lib'SUBSTR(libname,1,dot)'a'
  1309.  
  1310. 'ar qc 'gcclibname' #?.o'    /* archive new library */
  1311.  
  1312. 'ranlib 'gcclibname
  1313.  
  1314. IF EXISTS(gcclibname) THEN
  1315.   DO
  1316.     needslash = LASTPOS(':',path)
  1317.     IF ~(needslash == LENGTH(path)) THEN
  1318.       path = path'/'
  1319.     ECHO " The following indicate a hunk2gcc error:"
  1320.     ECHO " Short reloc into N_DATA, what should I do?
  1321.     ECHO " Short reloc into N_BSS, what should I do?
  1322.     ECHO ""
  1323.     ECHO ""
  1324.     ECHO " Remember to move/rename "path"object2/"gcclibname" appropriately ."
  1325.   END
  1326. ELSE
  1327.   ECHO "No library created, what could have gone wrong ????"
  1328.  
  1329. EXIT
  1330.  
  1331. ERROR:
  1332.  
  1333.    ECHO " error = "RC
  1334.    ECHO " Hope its not the dreaded *Invalid Hunk type*"
  1335. EXIT
  1336.  
  1337.     h.  Inline Headers
  1338.  
  1339. [Christian Stieber] (maybe should clear out the specific bgui reference)
  1340.  
  1341. > compiling bgui:demos/font.c:
  1342. >   gcc -O3 -noixemul bgui:demos/font.c
  1343. > got errors:
  1344. >   font.c:100: unterminated macro call
  1345.  
  1346. This is because the inlined varargs aren't useful at all. Do
  1347. #define NO_INLINE_STDARG (or whatever it is called), and create
  1348. varargs stubs like this:
  1349.  
  1350. Prototype: BOOL SomeFunction(int, char *, ...);
  1351. and        BOOL SomeFunctionA(int, char *, APTR);
  1352.  
  1353. Stub function:
  1354. #define NO_INLINE_STDARG
  1355. #include <inline/someinline.h>
  1356. BOOL SomeFunction(int A, char *B, ...)
  1357. {
  1358.   return SomeFunctionA(A,B,(&B)+1);
  1359. }
  1360.  
  1361. That isn't really ANSI-C, but it works on all Amiga compilers I know of.
  1362.  
  1363. Create a .c file for every function, compile, ar and link it to
  1364. the program. Make sure the optimizer is on, else SomeFunctionA
  1365. won't be inlined.
  1366.  
  1367. How to create stubs for non-varargs functions:
  1368. In order to be able to compiler without -O, you want to create
  1369. stubs for the inline functions as well:
  1370.  
  1371. #define NO_INLINE_STDARG
  1372. #define SomeFunctionA InlinedSomeFunctionA
  1373. #include <inline/someinlines.h>
  1374. #undef SomeFunctionA
  1375. BOOL SomeFunctionA(int A, char *B, APTR C)
  1376. {
  1377.   return InlinedSomeFunctionA(A,B,C);
  1378. }
  1379.  
  1380. Again, create such a file for every function and put the *.o files
  1381. into the archive mentioned above.
  1382.  
  1383.      j. Writing Hooks
  1384.  
  1385. [Tomi Ollila]
  1386. > 1) How to I write a hook function - I.E. Specify which registers parameters
  1387. > should be received in and that the result should be returned in register D0.
  1388.  
  1389. One way to do this is to write the function entry the following way:
  1390.  
  1391. ULONG hook(void)
  1392. {
  1393.   register char * a0 __asm("a0");
  1394.   char * buffer = a0;
  1395.   register ULONG d0 __asm("d0");
  1396.   ULONG size = d0;
  1397.  
  1398.   ...
  1399.  
  1400.   return length;
  1401. }
  1402.  
  1403. We wrote some macros for AmiTCP/IP project to make it easier to write this
  1404. kind of function entries...
  1405.  
  1406. #define RAF2(funname, type1, arg1, reg1, type2, arg2, reg2) \
  1407.   funname(VOID)                     \
  1408. {                                   \
  1409.   register type1 reg1 __asm(#reg1); \
  1410.   type1 arg1 = reg1;                \
  1411.   register type2 reg2 __asm(#reg2); \
  1412.   type2 arg2 = reg2;
  1413.  
  1414.  
  1415. would make the above function look like:
  1416.  
  1417. ULONG RAF2(hook,
  1418.        char *,    buffer,    a0,
  1419.        ULONG,    size,    d0)
  1420. #if 0
  1421. {
  1422. #endif
  1423.  
  1424. The whole macro file `amiga_raf.h' is available at kampi.hut.fi, directory
  1425. /AmiTCP. It defines RAF1 - RAF7 for both GNU C and SAS C compilers (someone
  1426. could write these to DICE as well).
  1427.  
  1428.  > 2) Is there anyway to specify that a function should NOT be made inline (As
  1429.  > I wouldn't want the hook function inlined.
  1430.  
  1431. Compile it in a separate module. This way gcc doesn't see the function code
  1432. when compiling. If you give a pointer to the function, then it must also
  1433. exist as a callable function.
  1434.  
  1435.  
  1436.  
  1437.  
  1438. 5.  C++ and Objective C
  1439.  
  1440.     a. C++
  1441.  
  1442.     i)  Use _complex.h instead of complex.h
  1443.         Because Amiga Dos is not case-sensitive, and there are
  1444. both complex.h and Complex.h on the Unix distribution, one had to be
  1445. changed.  This choice was recommended by the libg++ maintainer.
  1446.  
  1447.     (don't know much about these, except that they're not as well
  1448.      developed yet as the C compiler)
  1449.  
  1450. 6.  Notes For Un*x Hackers
  1451.  
  1452.      [additions to this section are welcome]    
  1453.        a. fork() is not implemented
  1454.          
  1455.           Here's a clip from Markus Wild's README in the ixemul source
  1456. distribution:
  1457.  
  1458.  
  1459. Some notes to vfork() and friends
  1460. =================================
  1461.  
  1462. **IX/BSD process management is one of the most nasty design differences
  1463. between AmigaDOS ans **IX/BSD. `fork()' for example is hardly possible to
  1464. implement on AmigaDOS, as it requires to create an identical copy of the
  1465. parent process. This is only feasible with virtual memory, where processes
  1466. can be mapped at equal places in memory. Under AmigaDOS this would have
  1467. to be simulated by copying of stack and malloc'd data whenever a process
  1468. is activated, and copying them to a safe place before it is disactivated.
  1469.  
  1470. This problem can be avoided, if the program to be run under AmigaDOS is
  1471. only fork()ing, because it just wants to start another process. In that
  1472. case, no such copying as described before is necessary, and BSD therefore
  1473. invented the `vfork()' function, which works like `fork', but runs the 
  1474. child on the parents memory segments (stack and malloc'd data). While the
  1475. child is using the parents resources, the parent is sleeping in a not
  1476. interruptible state. 
  1477.  
  1478. That much for theory;-) I tried to implement an as compatible as possible
  1479. vfork() function, that behaves like the BSD one. This should work under
  1480. any OS version, for Kickstart 1.3 the arp.library is used, starting with
  1481. OS 2.0 dos.library is powerful enough to do it itself.
  1482.  
  1483. Since I won't try to implement `fork', I provided a possible alternative
  1484. (you tell me;-)). As an extension, you get the `vfork_resume()' function,
  1485. which causes the parent to resume, just like it would if you called 
  1486. `_exit()' or one of the `exec*()' functions. Since this function is quite
  1487. dangerous (and an even bigger hack than vfork() itself..), here's what's
  1488. happening in `vfork_resume()':
  1489.  
  1490.   o  the child switches to its own stack. After vfork(), the child is
  1491.      using the stack of the parent process. Since no two processes can
  1492.      share the same stack in parallel, vfork_resume() causes a switch
  1493.      to the `real' stack of the child.
  1494.   o  the parent is sent a wakeup message.
  1495.   o  both processes run concurrently
  1496.  
  1497. The first point is the most important one: Since vfork_resume() changes
  1498. the stack pointer of the running process, you can't refer to any variables
  1499. or parameters anymore after calling vfork_resume()! Only register
  1500. variables survive such a call, and you have to explicitly store values
  1501. in register variables that are subject to survive!
  1502.  
  1503. There's another potential problem with vfork_resume():
  1504.  
  1505. **************************************************************************
  1506.   Don't exit() from the parent before all vfork()'d children have died!!
  1507. **************************************************************************
  1508.  
  1509. Since exiting from the parent causes the parents code and data segments to
  1510. be deallocated, the child would find itself without code space to run
  1511. on, and would probably cause a severe machine crash!
  1512.  
  1513. So always call at least `wait (0)' before returning from the parent.
  1514.  
  1515.  
  1516.  
  1517. exec*()
  1518. =======
  1519.  
  1520. In most cases, you just use `vfork()' to later overlay the process with 
  1521. a new image, that is you want to start another program. The way AmigaDOS
  1522. loads processes is not too well suited to do `exec' style program starting,
  1523. yet it is possible, although with slight resource wasting.. 
  1524.  
  1525. First problem is, that all exec* functions pass an argument vector to
  1526. the new program, whereas AmigaDOS programs expect to be passed an argument
  1527. line (instead of the vector of arguments). Since in my opinion it would
  1528. be a good thing if a program could get an argument vector directly (in that
  1529. case the inherent problem of passing multi word arguments to a program would
  1530. be finally solved, no more weird quoting needed!). That's why I provided
  1531. a mechanism that allows this vector passing, and it works like this (look
  1532. at crt0.c for a concrete implementation of this concept!):
  1533.  
  1534.   The program has to provide a magic header at the first executable location
  1535.   in its code. This magic header looks like this:
  1536.      o  JMP instruction to common AmigaDOS startup
  1537.      o  struct exec area. Use the OMAGIC a_magic code.
  1538.      o  provide an alternate entry vector in a_entry. execve() jumps thru
  1539.         this vector to pass vectors to your program, instead of going
  1540.         thru the normal AmigaDOS startup part.
  1541.  
  1542. As long as you use my crt0.o and libc.a, this whole thing is completely
  1543. transparent to your program, you only have to care for it, if you want
  1544. to support the mechanism in other languages as well.
  1545.  
  1546. The second problem is how to start `old' AmigaDOS programs from execve().
  1547. If the program has the described magic header, starting is easy. Else 
  1548. another approach is taken, depending on the OS version. Common to both
  1549. OS versions (1.3 and 2.0) is redirection of stdin and stdout. Since the
  1550. new program can't refer to the real file descriptors (I can't pass the
  1551. open library without my startup code), I have to setup DOS fields to
  1552. use my filehandles. This may succeed or not, depending on whether the
  1553. descriptors in question are realized by DOS files or not (in the future
  1554. a not-compatible alternative would be descriptors that refer to sockets!).
  1555. Actual starting of the program is done with RunCommand() under 2.0, and
  1556. some own hack under 1.3. If someone is interested to get this working
  1557. well under 1.3, I'd be happy to include a better starter function, my
  1558. kludge doesn't particularly deal graceful with BCPL functions...
  1559.  
  1560.  
  1561.  
  1562.  
  1563. 7.  Support Utilities
  1564.  
  1565.     a. Frontends
  1566.  
  1567.        I'm thinking of GUI's here.  There is one (something like GCC_Frontend)
  1568. on the April 1994 Aminet CD-ROM collection.  If I remember correctly though,
  1569. when I tried using it, it bugged out on me.  Anybody know of anything else?
  1570.  
  1571.     b. Debuggers  (Maybe just GDB?)
  1572.          
  1573.           GDB is the GNU debugger, and Fred Fish is the port master for it.
  1574. Here is something from his readme.
  1575.  
  1576.  
  1577. GDB 4.12 has been ported to the extent that you can build an AmigaDOS
  1578. executable that knows how to load and examine executables from non-AmigaDOS
  1579. systems.  Much work remains.  See the gnu:src/diffs/gdb-4.12-README file.
  1580.  
  1581. [He's referring to the general gnu:source directory.  If you unpack the
  1582. gdb source archive to your GNU: directory, it should be in that same directory.]
  1583.  
  1584.  
  1585.  
  1586.     c. What else?
  1587.  
  1588. 8.  Additional Support 
  1589.  
  1590.     a. amiga-gcc-port mailing list
  1591.  
  1592.     b. snail mail (?)  - for people getting it off of CD-ROM
  1593.     
  1594.     c. You never know, it could be a problem in base FSF code
  1595.  
  1596.        gnu.gcc Newsgroup and daughter newsgroups
  1597.        ftp: prep.ai.mit.edu in /pub/gnu  is the primary archive for the GNU
  1598.         Project.  If you need the FSF baseline code for something,
  1599.         it'll be there.
  1600.  
  1601. 9.  Known Bugs
  1602.     
  1603.     a. C compiler
  1604.        
  1605.        i) -resident option
  1606.         This has been broken since 2.3.3.  Hence, you'll need to get
  1607. that version if you want to compile a program you can easily make resident.
  1608.          Of course, you can always write your code to be resident, it
  1609. just takes a little more effort (see above).
  1610.  
  1611.         This is fixed in 2.7.0.
  1612.  
  1613.        ii) -fbaserel option 
  1614.         Won't be fixed until the -resident option is (as it's the
  1615. cause of the -resident problem).
  1616.  
  1617.     b.  C++ compiler (g++)
  1618.  
  1619.     c.  Objective C compiler 
  1620.  
  1621. 10. Maintainers and Contributors
  1622.  
  1623. Gcc v2.2.2 port:   Markus Wild
  1624. Gcc v2.3.3 port:   Markus Wild
  1625. Gcc v2.4.5 port:   Philippe Brand, Lars Hecking, Fred Fish
  1626. Gcc v2.5.0 and up: Philippe Brand, Fred Fish, Leonard Norrgard 
  1627.  
  1628. Ixemul.library:    Markus Wild, Leonard Norrgard, R. Luebbert
  1629. Libnix:            Matthias Fleischer, Gunther Nikl
  1630.  
  1631. Also, much testing, suggestions and debate have been provided by
  1632. Jorg  Hoehle
  1633. Peter Ivemey-Cook
  1634. Christian Stieber
  1635. Walter Harms
  1636. Lars Hecking
  1637. Kriton Kyrimis
  1638. Niklas Hallqvist
  1639. Jochen Wiedmann
  1640. Thomas Walter
  1641.  
  1642.    not necessarily in that order.
  1643.  
  1644. [ I just compiled this list from looking at the 1995 archive and some of the
  1645. '94, whoever consistently either (a) made suggestions and wrote some code
  1646. or (b) has been reporting bugs from attempts at compiling GNU software
  1647. for a long time (i.e. not someone who's just having problems porting their
  1648. favorite package).  If I've left someone out, or if you have a problem
  1649. with my criteria, or if you think I should just thank the mailing list as
  1650. a whole, mail me].
  1651.  
  1652. The present FAQ maintainer is Lynn Winebarger (owinebar@indiana.edu).
  1653. However, you should send corrections to amiga-gcc-port@nic.funet.fi for
  1654. a look over, as that's what I'll do anyway.
  1655. [or maybe they should just send them to me, and I can screen out the 
  1656. very common screw-up from people who think they know.]
  1657. Flames directed to /dev/null.
  1658.  
  1659.  
  1660. 11. Future
  1661.  
  1662. 12. History
  1663.  
  1664. Appendix A: How does the GPL affect programs compiled by GCC?
  1665.  
  1666. [Niklas Hallqvist]
  1667.  
  1668. >    If I compile one of my sources with gcc, do I have to
  1669. > distribute it under the GPL? I'm not using any GNU libraries or
  1670. > startup or anything.  My interpretation of the GPL is that i
  1671. > don't have to, but one of the teacher (lecturers?) say that I
  1672. > have to. Who's right?
  1673.  
  1674. You are.  The GPL (and LGPL) only covers distributed code, not code
  1675. generated by tools which are GPL:ed. As there are code which get
  1676. linked by GCC distributed with GCC, libgcc.a, one might think that the
  1677. GPL would apply to generated code, but no, libgcc.a is written without
  1678. GPL just to enable that use of the GNU compiler.  Think about it,
  1679. several object-only commercial applications including OSes are
  1680. compiled by GCC for enhanced performance, would they do that if they
  1681. had to give up their objectcode-only policy?  The key behind the GPL
  1682. is that no code based on work GPLed, should be locked to to that
  1683. specific compilation, but the user should be able to customize the GPLed
  1684. code as he wants to and recompile.  You are still allowed to protect
  1685. your own source as you see fit.  For example, let's say you use som
  1686. LGPLed library libfoo.a in your application app.  When you distribute
  1687. it you must also distribute a linkable objectfile app.o which, when
  1688. linked with the distibuted libfoo.a (with source) generates app.  If
  1689. the end-user wants, he should be able to customize libfoo, and relink
  1690. it with app.o to get a customized app.  It's not a very severe
  1691. limitation on distribution rights IMHO.
  1692.  
  1693. Remember that the (L)GPL was written to give programmers more Freedom,
  1694. not to limit their chance of protecting their own work.  As long as
  1695. their own work is clearly delimited from others GPLed work, it's
  1696. perfectly OK to keep a separate copyright policy on it.
  1697.  
  1698. In your case, your lecturer has misunderstood the intentions of the
  1699. (L)GPL which is easy to do.  These discussions come up ever so often
  1700. because of the legaleze used to express the GPL.  Too bad many get the
  1701. GPL wrong, as rumours like "you cannot use GNU products for business
  1702. work" severly harms the usage of GNU products.  To name a few uses of
  1703. GCC where the program did NOT fall under the GPL:  Dell Unix SVR4,
  1704. NextStep & some OSF/1 port.  Tell your lecturer about these, and ask
  1705. him why he thinks the GPL prevents them to be sold during other than
  1706. GPL conditions?  I ask you to actually convince him he was wrong as it
  1707. is harmful for the programming society that such misconceptions exist.
  1708.  
  1709.     This is where I'd like to put that list of libraries that are GPLed.
  1710.  
  1711.  
  1712. Appendix B:  GNU Porting activities and who's dealing with them
  1713.  
  1714.     Not really GCC (Which is why it's an Appendix), but certainly one of
  1715. GCC's main uses.
  1716.       It would be good to keep track of these things anyway, in case someone
  1717. wants to start working on porting something (just as administratvia).
  1718.  
  1719.  
  1720. Appendix C:  Another Free C compiler (for those without much memory)
  1721.  
  1722.    Warning, apparently lcc is not yet fully ported (no backend) for easy
  1723. use.
  1724.  
  1725. [Fred Fish]
  1726.  
  1727. > > One of the things I hope to eventually add to my FreshFish CD is a
  1728. > > port of lcc, which is much smaller and faster than gcc, and apparently
  1729. > > somewhat more ANSI compliant.  I just haven't had time yet to look
  1730. > > at doing so.
  1731. > What's lcc? I never heard of it.
  1732.  
  1733. ============================ begin inclusion ===========================
  1734.  
  1735. lcc is the retargetable compiler for ANSI C described in our book
  1736. `A Retargetable C Compiler: Design and Implementation'
  1737. (Benjamin Cummings, 1995, ISBN 0-8053-1670-1), which will be available
  1738. in December 1994. lcc is in production use at Princeton University and
  1739. AT&T Bell Laboratories.
  1740.  
  1741. The public distribution directory contains the following files.
  1742.  
  1743. README    this file.
  1744.  
  1745. install.{ps,txt}
  1746.     describes the distribution and gives installation
  1747.     instructions. install.ps is the PostScript generated from
  1748.     the HTML document, install.html, which is included in the
  1749.     the distribution.
  1750.  
  1751. X.Y.tar.{Z,gz}
  1752.     a compressed tar files for the distribution of version X.Y,
  1753.     e.g., 3.0.tar.Z the tar file compressed with compress. This
  1754.     distribution includes user documentation, the front end, the
  1755.     driver program, code generators for the SPARC, MIPS R3000 and
  1756.     x86, and the code-generator generator that produced them. A
  1757.     .gz file is the tar file compressed with gzip instead
  1758.     of compress.
  1759.  
  1760. The distribution is available via `anonymous' ftp from
  1761. ftp.cs.princeton.edu (128.112.152.13) in the directory pub/lcc.
  1762. Obtaining and extracting the distribution into its own directory is
  1763. accomplished by the following commands. Replace `3.0' with the latest
  1764. version, which is the only one typically available; versions like
  1765. `3.0a' identify minor updates and versions like `3.1beta' identify
  1766. pre-releases (which might be incomplete). As suggested, use your login
  1767. as the password, and use ftp's binary transfer mode.
  1768.  
  1769. mkdir lcc
  1770. cd lcc
  1771. ftp ftp.cs.princeton.edu
  1772. anonymous
  1773. yourlogin
  1774. cd pub/lcc
  1775. binary
  1776. get 3.0.tar.Z dist.tar.Z
  1777. quit
  1778. zcat dist.tar | tar xpof -
  1779. rm dist.tar.Z
  1780.  
  1781. To be added to the lcc mailing list, send a message with the 1-line body
  1782.  
  1783. subscribe lcc
  1784.  
  1785. to majordomo@cs.princeton.edu. This line must appear in the message
  1786. body; `Subject:' lines are ignored. To learn more about mailing lists
  1787. served by majordomo, send a message with the body `help' to
  1788. majordomo@cs.princeton.edu.
  1789.  
  1790. Additional information about lcc and about our book is available on the
  1791. WWW at URL http://www.cs.princeton.edu/software/lcc.
  1792.  
  1793.  
  1794. Chris Fraser / cwf@research.att.com
  1795. David Hanson / drh@cs.princeton.edu
  1796. Thu Aug 18 13:36:15 EDT 1994
  1797.  
  1798.  
  1799.  
  1800.